﻿//подготовка списка вооружения

_unitfaction = toLower (faction player);
_playerSide = side player;
grpText = "";
_groupId = 0;
{
	if (side _x == _playerSide) then {
		_show = false;
		_units = units _x;
		_tmp = format [localize "STR_HA_brif_groupsLeader",_x, name (leader _x)];
		if (_showStartGroupMarkers) then {
			_tmp = format["<marker name='bgrBrifingStartMarkerGpID%1'>%2</marker>",_groupId,_tmp];;
		};
		_ind = 1;
		{
			if ((alive _x) && ((isMultiplayer)&&(_x in playableUnits)||((!isMultiplayer)&&(_x in switchableUnits))) && (side _x == _playerSide)) then {
				_tmp = _tmp + format["<br/>%1 - %2 (%3)",_ind,name _x,getText (configFile>>"cfgVehicles">>typeOf _x>>"displayName")];
				{
					_weapon = (configFile >> "cfgWeapons" >> _x);
					if (getNumber(_weapon >> "type") in [1,2,4,5]) then {
						_tmp = _tmp + " - " + getText(_weapon >> "displayName");
					};
				} forEach weapons _x;
				_show = true;
				_ind = _ind + 1;
			};
		} forEach _units;
		if _show then {
			if (_showStartGroupMarkers) then {
				_groupMarker = createMarkerLocal[format["bgrBrifingStartMarkerGpID%1",_groupId],position (leader _x)];
				_groupMarker setMarkerShapeLocal "ICON";
				_groupMarker setMarkerTypeLocal "group_1";
				_groupMarker setMarkerColorLocal "ColorRed";
				_groupMarker setMarkerAlphaLocal 0.3;
				_groupMarker setMarkerTextLocal format["%1",_x];
				_groupMarker spawn {
					sleep 0.1;
					if (!isNil 'bgr_frizTime_START') then {waitUntil{sleep 1; bgr_frizTime_START};};
					deleteMarkerLocal _this;
				};
			};
			grpText = grpText + _tmp + "<br/><br/><br/>";			
		};
		_groupId = _groupId + 1;
	};
} forEach allGroups;

_sit = player createDiaryRecord ["diary", ["Позывные и вооружение",grpText]];